/**
 * Created by benz on 2017/3/19.
 */
module.exports = app => {
    const Sequelize = app.Sequelize;
    return app.model.define('user', {
        id:{
            type:Sequelize.INTEGER,
            autoIncrement:true,
            allowNull:false,
            primaryKey:true,
            unique:true
        },
        userName: {
            type:Sequelize.STRING(33),
            allowNull:false
        },
        passWord: {
            type:Sequelize.STRING(33),
            allowNull:false
        },
        age: {
            type:Sequelize.INTEGER(1),
            allowNull:true
        }
    }, {
        timestamps:true,
        paranoid:true,
        underscored: false,
        classMethods: {
            associate() {
                app.model.User.hasMany(app.model.Article);
            }
        }
    });
};